import request from "@/utils/functions/request";

// 字段列表
export function ledgerTableTabApi(query: any): Promise<any> {
  return request({
    url: "/cdledger/ledger-table-do/ledgerTableTab",
    method: "get",
    params: query,
  });
}

// 获取数据源
export function dbInfoListApi(): Promise<any> {
  return request({
    url: "/cddatamodel/table/dbInfoList",
    method: "get",
  });
}

// 新增表
export function ledgerTableFormApi(data: any): Promise<any> {
  return request({
    url: "/cdledger/ledger-table-do/ledgerTableForm",
    method: "post",
    data,
  });
}

// 获取字段类型
export function fieldTypeListApi(data: any): Promise<any> {
  return request({
    url: "/cddatamodel/table/third/fieldTypeList/" + data,
    method: "get"
  });
}

// 获取菜单
export function loadMenuApi(params: any): Promise<any> {
  return request({
    url: "/user_right/loadMenu",
    method: "get",
    params
  });
}

// 新增表
export function addTableApi(data: any): Promise<any> {
  return request({
    url: "/cddatamodel/table/third/addTable",
    method: "post",
    data
  });
}

// 查看选中字段列表
export function ledgerTableFieldTabApi(params: any): Promise<any> {
  return request({
    url: "/cdledger/ledger-table-field-do/ledgerTableFieldTab",
    method: "get",
    params
  });
}

// 新增字段
export function addFiledApi(data: any): Promise<any> {
  return request({
    url: "/cddatamodel/table/third/addFiled",
    method: "post",
    data
  });
}

// 新增字段_wb
export function ledgerTableFieldFormListApi(data: any): Promise<any> {
  return request({
    url: "/cdledger/ledger-table-field-do/ledgerTableFieldFormList",
    method: "post",
    data
  });
}

// 新增字段_wb
export function ledgerTableFieldFormApi(data: any): Promise<any> {
  return request({
    url: "/cdledger/ledger-table-field-do/ledgerTableFieldForm",
    method: "post",
    data
  });
}

// 删除一个字段
export function deleteFiledApi(data: any): Promise<any> {
  return request({
    url: "/cddatamodel/table/third/deleteFiled/" + data,
    method: "get"
  });
}

// 删除一个字段
export function ledgerTableFieldDelApi(params: any): Promise<any> {
  return request({
    url: "/cdledger/ledger-table-field-do/ledgerTableFieldDel",
    method: "get",
    params
  });
}
